<div class="accordination detail-union">
<h2 class="thead">
	<?php 
		echo t('PART_PERSONAL_INFO','advanceProfile');
		if($model->advanceProfile->code != null){
			echo ': <span style="color:red">'. Html::encode($model->advanceProfile->code) . '</span>';
		}	
	?>
</h2>
<table class="pdetail">
	<tbody>
		<tr>
			<td class="yel" style="width: 190px;"><?php echo t('LBL_ID_CARD_NUMBER','advanceProfile'); ?></td>
			<td><?php echo Html::encode($model->advanceProfile->id_card_number);?></td>	        
		</tr>
		<tr>
			<td class="yel"><?php echo t('LBL_ID_CARD_PROVIDED_DATE','advanceProfile'); ?></td>
			<td><?php echo Html::encode($model->advanceProfile->id_card_provided_date);?></td>	        
		</tr>
		<tr>
			<td class="yel"><?php echo t('LBL_ID_CARD_PROVIDED_PLACE','advanceProfile'); ?></td>
			<td><?php echo Html::encode($model->advanceProfile->id_card_provided_place);?></td>	        
		</tr>
		<tr>
			<td class="yel"><?php echo t('LBL_PASSPORT_NUMBER','advanceProfile'); ?></td>
			<td><?php echo Html::encode($model->advanceProfile->passport_number);?></td>	        
		</tr>
		<tr>
			<td class="yel"><?php echo t('LBL_PASSPORT_PROVIDED_DATE','advanceProfile'); ?></td>
			<td><?php echo Html::encode($model->advanceProfile->passport_provided_date);?></td>	        
		</tr>
		<tr>
			<td class="yel"><?php echo t('LBL_PASSPORT_PROVIDED_PLACE','advanceProfile'); ?></td>
			<td><?php echo Html::encode($model->advanceProfile->passport_provided_place);?></td>	        
		</tr>
	</tbody>
</table>
</div>
<?php if($model->advanceProfile->note != ''): ?>
<div class="accordination">
<h2 class="thead">Ghi chú</h2>
<table class="pdetail">
	<tbody>
		<tr>
			<td><?php echo Html::encode($model->advanceProfile->note);?></td>				       
		</tr>		
	</tbody>
</table>
</div>
<?php endif;?>
<div class="accordination detail-union">
<h2 class="thead"><?php echo t('PART_SELECTED_INFO','advanceProfile'); ?></h2>
<table class="pdetail">
	<tbody>
		<tr>
			<td class="yel" style="width: 190px;"><?php echo t('LBL_CONTRACT_NUMBER','advanceProfile'); ?></td>
			<td><?php echo Html::encode($model->advanceProfile->contract_number);?></td>	        
		</tr>
		<tr>
			<td class="yel" style="width: 190px;"><?php echo t('LBL_DISPATCHING_COMPANY','advanceProfile'); ?></td>
			<td><?php echo Html::encode($model->advanceProfile->dispatching_company);?></td>	        
		</tr>
		<tr>
			<td class="yel" style="width: 190px;"><?php echo t('LBL_HIRING_COMPANY_ID','advanceProfile'); ?></td>
			<td><?php echo Html::encode($model->advanceProfile->hiringCompany->name);?></td>	        
		</tr>
		<?php
		$logedInUser = User::model()->findByPk(Yii::app()->user->id);
        if ($logedInUser->isAdmin() || $logedInUser->isSuperAdmin()){
			echo '<tr>
				<td class="yel">'; 
					echo t('LBL_SALARY','advanceProfile'); 
			echo '</td>
				<td>';
					echo Html::encode($model->advanceProfile->salary);
			echo '</td>	        
			</tr>
			<tr>
				<td class="yel">'; 
					echo t('LBL_MANAGEMENT_FEE','advanceProfile'); 
			echo '</td>
				<td> ';
					echo Html::encode($model->advanceProfile->management_fee);
			echo '</td>	        
			</tr>
			<tr>
				<td class="yel">';
					echo t('LBL_INTRODUCING_FEE','advanceProfile'); 
			echo '</td>
				<td>'; 
					echo Html::encode($model->advanceProfile->hiringCompany->introducing_fee);
			echo '</td>	        
			</tr>';
		}
		?>
		<tr>
			<td class="yel"><?php echo t('LBL_INTRODUCING_COMPANY_ID','advanceProfile'); ?></td>
			<td><?php echo Html::encode($model->advanceProfile->introducingCompany->name);?></td>	        
		</tr>
		<tr>
			<td class="yel"><?php echo t('LBL_APPLY_DATE','advanceProfile'); ?></td>
			<td><?php echo Html::encode($model->advanceProfile->apply_date);?></td>	        
		</tr>
		<tr>
			<td class="yel"><?php echo t('LBL_SELECTED_DATE','advanceProfile'); ?></td>
			<td><?php echo Html::encode($model->advanceProfile->selected_date);?></td>	        
		</tr>
		<tr>
			<td class="yel"><?php echo t('LBL_ORDER','advanceProfile'); ?></td>
			<td><?php echo Html::encode($model->advanceProfile->order);?></td>	        
		</tr>
		<tr>
			<td class="yel"><?php echo t('LBL_CONTRACT_DURATION','advanceProfile'); ?></td>
			<td><?php echo Html::encode($model->advanceProfile->contract_duration);?></td>	        
		</tr>
		<tr>
			<td class="yel"><?php echo t('LBL_COMPLETE_CONTRACT_DATE','advanceProfile'); ?></td>
			<td><?php echo Html::encode($model->advanceProfile->complete_contract_date);?></td>	        
		</tr>
		<tr>
			<td class="yel"><?php echo t('LBL_BACK_DATE_BEFORE_CONTRACT','advanceProfile'); ?></td>
			<td><?php echo Html::encode($model->advanceProfile->back_date_before_contract);?></td>	        
		</tr>
	</tbody>
</table>
</div>

<div class="accordination detail-union">
<h2 class="thead"><?php echo t('PART_FLIGHT_INFO','advanceProfile'), ": ", $model->advanceProfile->go_date; ?></h2>
<table class="pdetail">
	<tbody>
		<tr>
			<td class="yel" style="width: 190px;"><?php echo t('LBL_GO_DATE','advanceProfile'); ?></td>
			<td><?php echo Html::encode($model->advanceProfile->go_date);?></td>	        
		</tr>
		<tr>
			<td class="yel"><?php echo t('LBL_ARRIVE_CITY','advanceProfile'); ?></td>
			<td><?php echo Html::encode($model->advanceProfile->arrive_city);?></td>	        
		</tr>
		<tr>
			<td class="yel"><?php echo t('LBL_FLIGHT','advanceProfile'); ?></td>
			<td><?php echo Html::encode($model->advanceProfile->flight);?></td>	        
		</tr>
		<tr>
			<td class="yel"><?php echo t('LBL_VISA_ADDRESS','advanceProfile'); ?></td>
			<td><?php echo Html::encode($model->advanceProfile->visa_address);?></td>	        
		</tr>
	</tbody>
</table>
</div>

<div class="accordination detail-union">
<h2 class="thead"><?php echo t('PART_UNION_INFO','advanceProfile'), " ", $model->advanceProfile->hiringCompany->union->name;?></h2>
<table class="pdetail">
	<tbody>
		<tr>
			<td class="yel" style="width: 190px;"><?php echo t('LBL_NAME','union'); ?></td>
			<td><?php echo Html::encode($model->advanceProfile->hiringCompany->union->name);?></td>	        
		</tr>
		<tr>
			<td class="yel"><?php echo t('LBL_ADDRESS','union'); ?></td>
			<td><?php echo Html::encode($model->advanceProfile->hiringCompany->union->address);?></td>	        
		</tr>
		<tr>
			<td class="yel"><?php echo t('LBL_PHONE_NUMBER','union'); ?></td>
			<td><?php echo Html::encode($model->advanceProfile->hiringCompany->union->phone_number);?></td>	        
		</tr>
		<tr>
			<td class="yel"><?php echo t('LBL_PRESIDENT','union'); ?></td>
			<td><?php echo Html::encode($model->advanceProfile->hiringCompany->union->president);?></td>	        
		</tr>
		<?php 
		if ($logedInUser->isAdmin() || $logedInUser->isSuperAdmin()){
		echo '<tr>
			<td class="yel">'. t('LBL_ALLOWANCE','union') . '</td>
			<td>' . Html::encode($model->advanceProfile->hiringCompany->union->allowance). '</td>	        
		</tr>
		<tr>
			<td class="yel">' . t('LBL_MANAGEMENT_FEE','union') . '</td>
			<td>' . Html::encode($model->advanceProfile->hiringCompany->union->management_fee) . '</td>	        
		</tr>';
		}
		?>
		<tr>
			<td class="yel"><?php echo t('LBL_SIGNING_CONTRACT_DATE','union'); ?></td>
			<td><?php echo Html::encode($model->advanceProfile->hiringCompany->union->signing_contract_date);?></td>	        
		</tr>
		<tr>
			<td class="yel"><?php echo t('LBL_DISPATCHED_COMPANY','union'); ?></td>
			<td><?php echo Html::encode($model->advanceProfile->hiringCompany->union->dispatched_company);?></td>	        
		</tr>
	</tbody>
</table>
</div>

<div class="accordination detail-union">
<h2 class="thead"><?php echo t('PART_HIRING_COMPANY_INFO','advanceProfile'), " ", $model->advanceProfile->hiringCompany->name?></h2>
<table class="pdetail">
	<tbody>
		<tr>
			<td class="yel" style="width: 190px;"><?php echo t('LBL_CODE','hiringCompany'); ?></td>
			<td><?php echo Html::encode($model->advanceProfile->hiringCompany->code);?></td>	        
		</tr>
		<tr>
			<td class="yel"><?php echo t('LBL_NAME','hiringCompany'); ?></td>
			<td><?php echo Html::encode($model->advanceProfile->hiringCompany->name);?></td>	        
		</tr>
		<tr>
			<td class="yel"><?php echo t('LBL_DIRECTOR','hiringCompany'); ?></td>
			<td><?php echo Html::encode($model->advanceProfile->hiringCompany->director);?></td>	        
		</tr>
		<tr>
			<td class="yel"><?php echo t('LBL_ADDRESS','hiringCompany'); ?></td>
			<td><?php echo Html::encode($model->advanceProfile->hiringCompany->address);?></td>	        
		</tr>
		<tr>
			<td class="yel"><?php echo t('LBL_PHONE_NUMBER','hiringCompany'); ?></td>
			<td><?php echo Html::encode($model->advanceProfile->hiringCompany->phone_number);?></td>	        
		</tr>
		<?php
		$logedInUser = User::model()->findByPk(Yii::app()->user->id);
        if ($logedInUser->isAdmin() || $logedInUser->isSuperAdmin()){
		echo '<tr>
			<td class="yel">'; 
				echo t('LBL_SALARY','hiringCompany'); 
		echo '</td>
			<td>';
				echo Html::encode($model->advanceProfile->hiringCompany->salary);
		echo '</td>	        
		</tr>
		<tr>
			<td class="yel">';
				echo t('LBL_FIRST_MONTH_ALLOWANCE','hiringCompany'); 
		echo '</td>
			<td>'; 
				echo Html::encode($model->advanceProfile->hiringCompany->first_month_allowance);
		echo '</td>	        
		</tr>
		<tr>
			<td class="yel">';
				 echo t('LBL_INTRODUCING_FEE','hiringCompany'); 
		echo '</td>
			<td>';
				echo Html::encode($model->advanceProfile->hiringCompany->introducing_fee);
		echo '</td>	        
		</tr>
		<tr>
			<td class="yel">';
				echo t('LBL_MANAGEMENT_FEE','hiringCompany');
		echo '</td>
			<td>';
				echo Html::encode($model->advanceProfile->hiringCompany->management_fee);	        
		echo '</td>
		</tr>';
		}
		?>
	</tbody>
</table>
</div>

<div class="accordination detail-union">
<h2 class="thead"><?php echo t('PART_INTRODUCING_COMPANY_INFO','advanceProfile'), " ", $model->advanceProfile->introducingCompany->name?></h2>
<table class="pdetail">
	<tbody>
		<tr>
			<td class="yel" style="width: 190px;"><?php echo t('LBL_CODE','introducingCompany'); ?></td>
			<td><?php echo Html::encode($model->advanceProfile->introducingCompany->code);?></td>	        
		</tr>
		<tr>
			<td class="yel"><?php echo t('LBL_NAME','introducingCompany'); ?></td>
			<td><?php echo Html::encode($model->advanceProfile->introducingCompany->name);?></td>	        
		</tr>
		<tr>
			<td class="yel"><?php echo t('LBL_ENGLISH_NAME','introducingCompany'); ?></td>
			<td><?php echo Html::encode($model->advanceProfile->introducingCompany->english_name);?></td>	        
		</tr>
		<tr>
			<td class="yel"><?php echo t('LBL_SHORT_NAME','introducingCompany'); ?></td>
			<td><?php echo Html::encode($model->advanceProfile->introducingCompany->short_name);?></td>	        
		</tr>
		<tr>
			<td class="yel"><?php echo t('LBL_ADDRESS','introducingCompany'); ?></td>
			<td><?php echo Html::encode($model->advanceProfile->introducingCompany->address);?></td>	        
		</tr>
		<tr>
			<td class="yel"><?php echo t('LBL_PHONE_NUMBER','introducingCompany'); ?></td>
			<td><?php echo Html::encode($model->advanceProfile->introducingCompany->phone_number);?></td>	        
		</tr>
		<tr>
			<td class="yel"><?php echo t('LBL_REPRESENTATIVE','introducingCompany'); ?></td>
			<td><?php echo Html::encode($model->advanceProfile->introducingCompany->representative);?></td>	        
		</tr>
		<tr>
			<td class="yel"><?php echo t('LBL_TITLE','introducingCompany'); ?></td>
			<td><?php echo Html::encode($model->advanceProfile->introducingCompany->title);?></td>	        
		</tr>
		<tr>
			<td class="yel"><?php echo t('LBL_JOB_APPROVER','introducingCompany'); ?></td>
			<td><?php echo Html::encode($model->advanceProfile->introducingCompany->job_approver);?></td>	        
		</tr>
	</tbody>
</table>
</div>

<div class="accordination detail-union">
<h2 class="thead"><?php echo t('PART_ATTACHMENT','advanceProfile')?></h2>
<table class="pdetail">
	<tbody>
		<?php 	
			if($model->attachments != null && count($model->attachments) > 0){
				$index=1;
				foreach($model->attachments as $id => $item ) :
					echo '<tr>
							<td>' . $index. '. ' . CHtml::link(CHtml::encode($item->name), Yii::app()->baseUrl . "/../media/attachment/" .$item->file_name, array("target"=>"_blank")) . '</td>
						</tr>';
					$index++;
				endforeach;
			}
		?>
	</tbody>
</table>
</div>

<div id="show-hide-accordination">Hiển thị tất cả</div>
<script type="text/javascript">
	$("#show-hide-accordination").toggle(
	   function () {
		   $(".accordination").each(function(){				
				$(this).find(".pdetail").show();
				$(this).find(".thead").removeClass("tshow");
		   });
		   $(this).text("Ẩn tất cả");
	   },
	   function () {				   
		   $(".accordination").each(function(){				
				$(this).find(".pdetail").hide();
				$(this).find(".thead").addClass("tshow");
		   });
		   $(this).text("Hiển thị tất cả");
	   });		   
</script>